package com.emagic.manage.events;

import android.support.annotation.IntDef;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

public class DataUpdateEvent {
    public static final int FROM_FLAG_COMMENT = 0x1;
    public static final int FROM_FLAG_REPLY = 0x2;
    public static final int FROM_FLAG_PUBLISH = 0x3;
    public static final int FROM_FLAG_COMMENT_DEL = 0x4;
    public static final int FROM_FLAG_CIRCLE_DEL = 0x5;
    public static final int FROM_FLAG_PROPERTY_PAY = 0x6;
    public static final int FROM_FLAG_LOTTERY_FILL_INFO = 0x7;
    public static final int FROM_FLAG_BUTLER_COMMENT = 0x8;
    public static final int FROM_FLAG_PRAISE = 0x9;

    @IntDef(value = {FROM_FLAG_COMMENT, FROM_FLAG_REPLY, FROM_FLAG_PUBLISH, FROM_FLAG_COMMENT_DEL, FROM_FLAG_CIRCLE_DEL, FROM_FLAG_PROPERTY_PAY, FROM_FLAG_LOTTERY_FILL_INFO, FROM_FLAG_BUTLER_COMMENT, FROM_FLAG_PRAISE})
    @Retention(RetentionPolicy.SOURCE) //
    public @interface From {
    }

    private final int from;

    public DataUpdateEvent(@From int from) {
        this.from = from;
    }

    @From
    public int getFrom() {
        return from;
    }

    public static DataUpdateEvent comment() {
        return new DataUpdateEvent(FROM_FLAG_COMMENT);
    }

    public static DataUpdateEvent commentDel() {
        return new DataUpdateEvent(FROM_FLAG_COMMENT_DEL);
    }

    public static DataUpdateEvent reply() {
        return new DataUpdateEvent(FROM_FLAG_REPLY);
    }

    public static DataUpdateEvent circleDel() {
        return new DataUpdateEvent(FROM_FLAG_CIRCLE_DEL);
    }

    public static DataUpdateEvent publish() {
        return new DataUpdateEvent(FROM_FLAG_PUBLISH);
    }

    public static DataUpdateEvent propertyPay() {
        return new DataUpdateEvent(FROM_FLAG_PROPERTY_PAY);
    }

    public static DataUpdateEvent lotteryFillInfo() {
        return new DataUpdateEvent(FROM_FLAG_LOTTERY_FILL_INFO);
    }

    public static DataUpdateEvent butlerComment() {
        return new DataUpdateEvent(FROM_FLAG_BUTLER_COMMENT);
    }

    public static DataUpdateEvent praise(){
        return new DataUpdateEvent(FROM_FLAG_PRAISE);
    }
}
